using UnityEngine;

public class TestNumberDemo : MonoBehaviour
{
    enum NumberType
    {
        Damage,
        Heal,
    }
    enum TextType
    {
        Pop,
        Miss,
        Cirt,
        End
    }
    public Vector2Int NumberRange;
    public float NumberYoffset;
    public ParticleNumbers particleNumbers;
    public ParticleTextures ParticleTextures;
    public float Range = 10f;
    void Start()
    {

    }

    void TestEmitTexture()
    {
        Vector3 pos = Random.insideUnitSphere * Range + transform.position;
        int type = Random.Range(0, (int)TextType.End);

        var data = new TextureDisplayData()
        {
            Position = pos,
            Type = type
        };
        ParticleTextures.Emit(data);

    }
    void TestEmitDamage()
    {
        Vector3 pos = Random.insideUnitSphere * 10f + transform.position;
        int damageValue = Random.Range(NumberRange.x, NumberRange.y);
        var damageDisplayData = new DamageDisplayData
        {
            IsCrit = false,
            Position = pos + new Vector3(0, NumberYoffset, 0),
            Type = (int)NumberType.Damage,
            Value = Mathf.Abs(damageValue)
        };
        particleNumbers.EmitNums(damageDisplayData);
    }

    void Update()
    {
        if (ParticleTextures != null)
        {
            for (int i = 0; i < 20; i++)
            {
                TestEmitTexture();
            }
        }
        if(particleNumbers != null)
        {
            TestEmitDamage();
        }

    }
}
